<?php if (!defined('THINK_PATH')) exit();?><style>
    .form-group label{width: 120px}
</style>
<section class="content-header" >
    <h1>
        修改登陆密码
        <small>密码修改</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="<?php echo U();?>"><i class="fa fa-lock"></i> 密码</a></li>
        <li class="active">修改密码</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-success">
                <div class="box-header">
                    <h3 class="box-title">修改登陆密码</h3>
                </div>
                <div class="box-body">
                    <form id="admin_public_editpwd_form">
                        <div class="form-group">
                            <label>用户名  <i class="fa fa-user"></i>:</label>
                            <?php echo ($info["username"]); ?>&nbsp;&nbsp;(真实姓名： <?php echo ($info["realname"]); ?>)
                        </div>
                        <div class="form-group">
                            <label>E-mail  <i class="fa fa-envelope-o"></i>:</label>
                            <?php echo ($info["email"]); ?>
                        </div>
                        <div class="form-group">
                            <label>旧密码 <i class="fa fa-lock"></i>:</label>
                            <input class="form-control" id="admin_public_editpwd_form_old_password" 
                                   name="old_password" type="password"  />
                        </div>
                        <div class="form-group">
                            <label>新密码 <i class="fa fa-lock"></i>:</label>
                            <input  class="form-control"  type="password"  id="admin_public_editpwd_form_new_password" 
                                    name="new_password_confirmation" type="password"
                                    data-validation="length" data-validation-length="min6"
                                    data-validation-error-msg="密码应该为6-20位之间"/>
                        </div>
                        <div class="form-group">
                            <label>重复新密码 <i class="fa fa-lock"></i>:</label>
                            <input class="form-control"  id="admin_public_editpwd_form_new_pwdconfirm"
                                    name="new_password"
                                   type="password"  data-validation="confirmation" 
                                    data-validation-error-msg="输入两次密码不一致"/>
                        </div>
                        <div class="box-footer">
                            <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" id='admin_public_editpwd_form_submit'>提交</button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
    $(function () {
        $('#admin_public_editpwd_form_submit').click(function () {
            $('#admin_public_editpwd_form').submit()
        });
        $.validate({
                modules: 'security',
                onSuccess: function () {
                    adminPublicEditpwdFormSubmit();
                    return false;
                }
            });
    })
    function adminPublicEditpwdFormSubmit() {
        $.post('<?php echo U('Admin/public_editPwd');?>', $("#admin_public_editpwd_form").serialize(),
        function (res) {
            if (!res.status) {
                $.messager.alert('提示信息', res.info, 'error');
            } else {
                $.messager.confirm('提示信息', res.info, function (result) {
                    if (result)
                        window.location.href = res.url;
                });
            }
        })
    }
</script>